package com.example.myapplication;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    private Button button1=null;
    private Button button2=null;

    //onCreate相当于主界面的构造函数,程序运行时自动调用
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        this.getResources().getDrawable(R.mipmap.ic_launcher);
        Log.v("mylog","饿了");
        Log.wtf("mylog","饿死了");
        button1=findViewById(R.id.btn1);
        button2=findViewById(R.id.btn2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                button2.setText("按钮2被点击了");
            }
        });
    }

    public void click_method(View view) {
        button1.setText("按钮1被点击了");
    }
}